//
// Created by leo on 19-5-20.
//


#include <dlfcn.h>
#include "stdio.h"

typedef long (*PFN_TEST)(const char* szName, int nAge);
PFN_TEST g_Test = NULL;

int main()
{
    void* handle = dlopen("../lib/libdl_impl.so", RTLD_LAZY);
    if(!handle)
    {
        printf("ERROR, Message(%s).\n", dlerror());
        return -1;
    }

    g_Test = (PFN_TEST)dlsym(handle, "_Z4TestPKci");
    char* szError = dlerror();
    if(szError != NULL)
    {
        printf("ERROR, Message(%s).\n", szError);
        dlclose(handle);
        return -1;
    }
    if(g_Test != NULL)
    {
        g_Test ("wjshan", 80);
    }
    dlclose(handle);
    g_Test = NULL;
    return 0;
}